package com.handsome.中介者模式;

/**
 * @author niechun
 * @date 2023/3/19 18:09
 */
public class Client {
    public static void main(String[] args) {
        //创建一个中介者对象
        Mediator mediator=new ConcreteMediator();
        //创建一个闹钟
        AlarmColleague alarm=new AlarmColleague(mediator,"闹钟");
        //创建一个电视
        TelColleague television=new TelColleague(mediator,"电视");

        //闹钟发出消息
        System.out.println("闹钟发出消息后:");
        alarm.sendAlarm(3);
        //电视发出消息
        System.out.println("电视发出消息后:");
        television.control(1);
    }
}
